package com.webbei.share.action;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.beanutils.converters.DateConverter;
import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.webbei.share.service.ShareSer;;
public class Comment extends ActionSupport{
	private String comment_content;
	private Long production_id;
	private ShareSer ser;
	@SuppressWarnings("deprecation")
	public String Comment() throws IOException{
		String userName="ygh";
		if(ActionContext.getContext().getSession().get("username")!=null)
		{
			userName=(String)ActionContext.getContext().getSession().get("username");
		}
		Date now=new Date();
		if(ser.InsertComment(production_id, userName, comment_content,now)>0)
		{
			try {
				ServletActionContext.getResponse().getWriter().write("success");
				ServletActionContext.getResponse().setContentType("text/html");
				return null;
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		ServletActionContext.getResponse().setContentType("text/html");
		ServletActionContext.getResponse().getWriter().write("error");
		return null;
	}
	public ShareSer getSer() {
		return ser;
	}

	public void setSer(ShareSer ser) {
		this.ser = ser;
	}

	public String getComment_content() {
		return comment_content;
	}

	public void setComment_content(String comment_content) {
		this.comment_content = comment_content;
	}

	public Long getProduction_id() {
		return production_id;
	}

	public void setProduction_id(Long production_id) {
		this.production_id = production_id;
	}

	
}
